using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace zeroflag.Windows.Basics
{
	public partial class View<DataType> : UserControl
	{
		public View(Controller<DataType> controller)
			:this()
		{
			this.Controller = controller;
		}

		protected View()
		{
			InitializeComponent();
		}

		Controller<DataType> m_Controller;

		public Controller<DataType> Controller
		{
			get { return m_Controller; }
			protected set
			{
				if (m_Controller != value)
				{
					if (m_Controller != null)
					{
						m_Controller.View = null;
						this.components.Remove(m_Controller);
					}
					m_Controller = value;
					if (m_Controller != null)
					{
						m_Controller.View = this;
						this.components.Add(m_Controller);
					}
				}
			}
		}

		public RenderTarget RenderTarget
		{
			get { return renderTarget; }
			set { renderTarget = value; }
		}

	}
}
